﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:SpiralClock" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">


    <Style TargetType="{x:Type local:SpiralPanel}">

        <Setter Property="ClipToBounds" Value="False"/>
        
    </Style>

    <Style TargetType="{x:Type local:SpiralItemsControl}">
                <Style.Resources>
            <DrawingBrush x:Key="spiral"  Stretch="Uniform">
                <DrawingBrush.Drawing>
                    <DrawingGroup>
                        <DrawingGroup >
                            <DrawingGroup.ClipGeometry>
                                <RectangleGeometry Rect="-3,-2.75,6.5,6" />
                            </DrawingGroup.ClipGeometry>
                            <DrawingGroup x:Name="g4934" Transform="0,-1,-1,0,0.5,0.5">


                                <GeometryDrawing x:Name="path4143">
                                    <GeometryDrawing.Pen>
                                        <Pen Brush="#30000000" Thickness="0.03" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Miter" />
                                    </GeometryDrawing.Pen>
                                    <GeometryDrawing.Geometry>
                                        <PathGeometry FillRule="Nonzero" Figures="M1,0C1.043,-0.273 0.972,-0.561 0.795,-0.795 0.61,-1.043 0.324,-1.209 0,-1.25 -0.339,-1.293 -0.691,-1.195 -0.972,-0.972 -1.266,-0.739 -1.459,-0.39 -1.5,0 -1.543,0.406 -1.419,0.821 -1.149,1.149 -0.869,1.49 -0.456,1.709 0,1.75 0.472,1.793 0.95,1.642 1.326,1.326 1.713,0.999 1.958,0.522 2,0 2.043,-0.538 1.866,-1.08 1.503,-1.503 1.129,-1.937 0.589,-2.208 0,-2.25 -0.605,-2.293 -1.21,-2.09 -1.679,-1.679 -2.161,-1.259 -2.458,-0.655 -2.5,0 -2.543,0.671 -2.313,1.34 -1.856,1.856 -1.388,2.384 -0.721,2.708 0,2.75 0.737,2.793 1.47,2.537 2.033,2.033 2.608,1.518 2.958,0.788 3,0" />
                                    </GeometryDrawing.Geometry>
                                </GeometryDrawing>
                            </DrawingGroup>

                        </DrawingGroup>
                    </DrawingGroup>
                </DrawingBrush.Drawing>
            </DrawingBrush>
        </Style.Resources>
        <Setter Property="HourLabelStyle">
            <Setter.Value>
                <Style TargetType="TextBlock">
                    <Setter Property="Foreground" Value="Red"/>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Background" Value="{StaticResource spiral}"/>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <local:SpiralPanel/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:SpiralItemsControl}">
                	<ControlTemplate.Resources>
                		<Storyboard x:Key="heartBeat" AutoReverse="False" RepeatBehavior="Forever">
                			<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="PART_now">
                				<EasingColorKeyFrame KeyTime="0:0:0.4" Value="Red">
                					<EasingColorKeyFrame.EasingFunction>
                						<QuinticEase EasingMode="EaseIn"/>
                					</EasingColorKeyFrame.EasingFunction>
                				</EasingColorKeyFrame>
                				<EasingColorKeyFrame KeyTime="0:0:1" Value="#33FF0000">
                					<EasingColorKeyFrame.EasingFunction>
                						<QuinticEase EasingMode="EaseOut"/>
                					</EasingColorKeyFrame.EasingFunction>
                				</EasingColorKeyFrame>
                			</ColorAnimationUsingKeyFrames>
                		</Storyboard>
                	</ControlTemplate.Resources>
                    <Border x:Name="Bd"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        SnapsToDevicePixels="true"
                        Padding="1">
                        <Grid>
                            <Grid x:Name="PART_LayoutRoot">
      
                                <Canvas x:Name="PART_canvas">
                                	<Ellipse x:Name="PART_now" Fill="#33FF0000" HorizontalAlignment="Stretch" Stroke="Black" StrokeThickness="2"  />
                                </Canvas>
                            </Grid>
                            <ItemsPresenter  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </Grid>
                    </Border>
                	<ControlTemplate.Triggers>
                		<EventTrigger RoutedEvent="FrameworkElement.Loaded">
                			<BeginStoryboard Storyboard="{StaticResource heartBeat}"/>
                		</EventTrigger>
                	</ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
